package cn.magic.system.service.impl;

import cn.magic.basic.service.impl.BaseServiceImpl;

import cn.magic.system.domain.SystemDictionaryType;
import cn.magic.system.mapper.SystemDictionaryDetailMapper;
import cn.magic.system.mapper.SystemDictionaryTypeMapper;
import cn.magic.system.service.ISystemDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class SystemDictionaryTypeServiceImpl extends BaseServiceImpl<SystemDictionaryType> implements ISystemDictionaryTypeService {
    @Autowired
    private SystemDictionaryTypeMapper systemDictionaryTypeMapper;

    @Autowired
    private SystemDictionaryDetailMapper systemDictionaryDetailMapper;

    /** 
    * @Title: remove
    * @Description: 根据id删除信息,并且删除子数据
    * @Author: Mr.pc
    * @Version: 1.0
    * @Date:  2022/6/30 18:43  
    * @Parameters: [id]
    * @Return void
    */
    @Override
    @Transactional
    public void remove(Long id) {
        SystemDictionaryType systemDictionaryType = systemDictionaryTypeMapper.loadById(id);
        systemDictionaryDetailMapper.delChild(systemDictionaryType.getId());
        systemDictionaryTypeMapper.remove(id);
    }


}
